<template>
  <div>
    <h2>我是弟弟,我开的是我哥的车 {{ car }}</h2>
  </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
  name: "Younger",
  data() {
    return {
      car: "八手奥拓",
    };
  },
  mounted() {
    //一般来说都是在初始化的时候进行订阅的
    PubSub.subscribe("getCar", this.getCar);
  },
  methods: {
    getCar(_, value) {
      this.car = value;
    },
  },
};
</script>

<style></style>
